import http.client

#   建立连接
conn = http.client.HTTPConnection('localhost')
#   构建正文
param = 'username=admin&password=admin&savelogin=true'
#   构建头部
header = {'Content-Type': 'application/x-www-form-urlencoded', 'Accept': '*/*'}
#   发送POST请求
conn.request('POST', '/agileone/index.php/common/login', param, header)
#   获取响应内容
response = conn.getresponse().read()

print(response.decode())

if 'successful' in response.decode():
    print('Log in successfully.')
else:
    print('Log in failed.')
